import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import utils from './utils/utils'
import axios from 'axios'
import * as api from './utils/api'
import 'jquery/dist/jquery.min'
import 'bootstrap/dist/css/bootstrap.css' 

Vue.config.productionTip = false

axios.defaults.baseURL = '/api'
Vue.prototype.axios = axios

router.beforeEach((to,from,next)=>{
  if(to.meta.isLogin){
    console.log(to.meta.isLogin);
    // 进来的页面是需要验证是否登录的
    if(utils.getStorage('user')){
      next()
    }else{
      router.push('/login')
    }
  }else{
    // 不需要登录的页面
    next()
  }
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
